package ooday03;

import ooday02.Chick;
import ooday02.Dog;

public  class AnimalTest {
    public static void main(String[] args) {
       DogDemo[] dogs = new DogDemo[3];
       dogs[0] = new DogDemo("小黑",2,"黑");
       dogs[1] = new DogDemo("小白",1,"白");
       dogs[2] = new DogDemo("小黄",2,"黄色");
        System.out.println(dogs[0].name);
        dogs[1].age = 4;
        dogs[2].swim();
        for(int i=0;i< dogs.length;i++){
            System.out.println(dogs[i].name);
            dogs[i].eat();
        }
        ChickDemo[] jl = new ChickDemo[3];
        jl[0] = new ChickDemo("孔雀",2,"红色");
        jl[1] = new ChickDemo("黄山", 3, "白色");
        jl[3] = new ChickDemo("金山", 4, "黄色");
        for (int i=0;i< jl.length;i++){
            System.out.println(jl[i].age);
            jl[i].layEgg();
        }





    }
}
